package demo5;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//@Repository 数据持久层的类(与数据库打交道)
//@Service 业务层
//@Controller 控制层
//@Repository
//@Service
//@Controller

@Component
public class Person {
    /*
    @Autowired 注解，自动装配 有多个匹配时可以使用@Qualifier注解，指定bean的id,默认按照类型装配,
    @Component("person")设别名
    @Resource(name = "shirt") 注解，自动装配 有多个实现类时，使用@Resource注解，指定bean的id,默认按照类型装配,
    类名小写是id
     */

//    @Autowired
//    @Resource(name = "shirt")
//    private Clothes clothes;
    @Resource
    private Clothes shirt;
    public void play(){
        shirt.wear();
        System.out.println("出门玩耍");
    }
}
